{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-page">
	<h3 class="pb-3">店铺URL</h3>
	<table class="layui-table layui-table-form">
		<tr>
			<td class="layui-td-gray">店铺名称<font>*</font></td>
			<td><input type="text" name="name" lay-verify="required" placeholder="请输入店铺名称" lay-reqText="请输入店铺名称L" class="layui-input" value="{$links.name|default=''}"></td>
		</tr>
		<tr>
			<td class="layui-td-gray">店铺账号</td>
			<td><select name="target" >
				<option value="">无</option>
				{volist name="admin" id="v"}
				<option value="{$v.id}"{notempty name="$links.target"} {eq name="$links.target" value="$v.id"}selected{/eq}{/notempty}  >{$v.nickname}</option>
				{/volist}
			</select>

			</td>
		</tr>
		<tr>
			<td class="layui-td-gray">店铺URL<font>*</font></td>
			<td><input type="text" name="src" lay-verify="required" placeholder="请输入店铺URL" lay-reqText="请输入店铺URL" class="layui-input" value="{$links.src|default=''}"></td>
		</tr>
		<tr>
			<td class="layui-td-gray">排序</td>
			<td><input type="text" name="sort" placeholder="请输入排序，数字" class="layui-input" value="{$links.sort|default='0'}"></td>
		</tr>
	</table>

	<div class="py-3">
		<input type="hidden" name="id" value="{$id}" />
		<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	</div>
</form>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
	const moduleInit = ['tool'];
	function gouguInit() {
		var form = layui.form,tool=layui.tool,upload = layui.upload;
		//监听提交
		form.on('submit(webform)', function (data) {
			let callback = function (e) {
				layer.msg(e.msg);
				if (e.code == 0) {
					tool.sideClose(1000);
				}
			}
			tool.post("/admin/links/add", data.field, callback);
			return false;
		});
	}
</script>
{/block}
<!-- /脚本 -->